import request from './request'

/**
 * 获取缓存统计信息
 */
export function getCacheStats() {
  return request({
    url: '/log/cache/stats',
    method: 'get'
  })
}

/**
 * 获取指定日期的缓存日志数量
 */
export function getCacheCount(date) {
  return request({
    url: `/log/cache/count/${date}`,
    method: 'get'
  })
}

/**
 * 手动触发回写任务
 */
export function triggerWriteBack() {
  return request({
    url: '/log/cache/writeback',
    method: 'post'
  })
}

/**
 * 获取回写任务状态
 */
export function getWriteBackStatus() {
  return request({
    url: '/log/cache/writeback/status',
    method: 'get'
  })
}

/**
 * 删除指定日期的缓存
 */
export function deleteCachedLogs(date) {
  return request({
    url: `/log/cache/cache/${date}`,
    method: 'delete'
  })
}

